home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
MacHack 1997
/
MacHack 1997.toast
/
Hacks
/
Hacks ’96
/
FontMancer
/
CDEF
/
Sources
/
app.c
next >
Wrap
C/C++ Source or Header
|
1996-06-21
|
996b
|
48 lines
#include <Controls.h>
#include <Fonts.h>
#include <Windows.h>
#include <Dialogs.h>
#include <Resources.h>
void InitToolbox(void);
void InitToolbox(void)
{
InitGraf(&qd.thePort);
InitFonts();
FlushEvents(everyEvent,0);
InitWindows();
TEInit();
InitDialogs(0L);
InitCursor();
DrawMenuBar();
}
void main ( void )
{
WindowPtr theWindow;
PicHandle buttonPic;
ControlHandle theControl;
Rect ctrlRect;
short itemHit;
Point mouseLoc;
EventRecord theEvent;
InitToolbox();
SetRect(&ctrlRect,10,10,42,42);
theWindow=GetNewWindow(200,0L,(WindowRef)-1);
buttonPic = GetPicture(128);
ShowWindow(theWindow);
theControl=NewControl(theWindow,&ctrlRect,"\ptest",0,0,0,1,2048,24);
SetCRefCon(theControl,(long) buttonPic);
ShowControl(theControl);
GetMouse(&mouseLoc);
while (!Button());
itemHit = TrackControl(theControl,mouseLoc,0L);
if (itemHit) SetControlValue(theControl,1);
while (!Button());
FlushEvents(everyEvent,0);
ReleaseResource((Handle) buttonPic);
}